<template>
	<div class="all" v-loading="loading" v-if="paperdata.paper!=undefined||paperdata.paper!=null">
		<div class="allhead">
			<span>{{ paperdata.name }}</span>
		</div>
		<div class="totalhead">
			<!-- <div style="margin-right:30px">难度：{{paperdata.difficulty}}</div> -->
			<div>试卷时长：{{ paperdata.paper.duration }}分钟</div>
		</div>
		<div class="ftable">
			<div class="table">
				<div>
					<div class="table-top">题目</div>
					<div class="table-bottom">分值</div>
				</div>
				<div v-for="(table, tableindex) in paperdata.paper.structureList" :key="tableindex">
					<div class="table-top">{{ tableindex + 1 }}</div>
					<div class="table-bottom">{{ table.score }}</div>
				</div>
				<div>
					<div class="table-top-end">总分</div>
					<div class="table-bottom-end">{{ paperdata.paper.score}}</div>
				</div>
			</div>
		</div>
		<div v-for="(paperitem, total) in paperdata.paper.structureList" :key="total">
			<div class="paperitemhead">
				<span>{{ paperitem.name }}（{{ paperitem.score }}分）</span>
			</div>
			<div class="box" v-for="(tabledata, i) in paperitem.container" :key="i">
				<div class="oneselect-cotainer" v-if="tabledata.type == '单选题' || tabledata.type == '单项选择题'">
					<div class="oneselect-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">单选</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.smallTopic
							}}
						</span>
						<span class="score">({{ tabledata.fraction }}分)</span>
					</div>
					<el-radio-group
						v-model="tabledata.examAnswer.optiones"
						@change="checked => radioChnage(checked, tabledata.examAnswer,tabledata.options)"
					>
						<el-radio
							class="oneselect-body"
							disabled
							style="display:block;"
							v-for="(item, i2) in tabledata.options"
							:key="i2"
							:label="String.fromCharCode(i2 + 65)"
						>{{ String.fromCharCode(i2 + 65) }}.{{ item.context }}</el-radio>
					</el-radio-group>
					<div style="display:flex;width:100%;">
						<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
							<span style="display: block;color:#E6A23C">学生答案：</span>
							<span style="display: block;color:#E6A23C">{{tabledata.examAnswer.optiones}}</span>
						</div>
						<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:20px">
							<span style="color:#67C23A">标准答案：</span>
							<span style="color:#67C23A" v-for="(item3, i3) in tabledata.options" :key="i3">
								<span v-if="item3.keyTrue">{{ String.fromCharCode(i3 + 65) }}</span>
							</span>
						</div>
						<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
							<span style="color:#E6A23C">学生得分：</span>
							<span style="color:#E6A23C">{{tabledata.examAnswer.score}}</span>
						</div>
						<!-- <div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
             <span style="display: block;color:#67C23A" >教师评分： </span>
                          <div>
                    <el-input
               style="width:40%"
               type="number"
						></el-input>-->
					</div>
				</div>

				<div class="more-cotainer" v-if="tabledata.type == '多选题' || tabledata.type == '多项选择题'">
					<div class="more-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">多选</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.smallTopic
							}}
						</span>
						<span class="score">({{ tabledata.fraction }}分)</span>
					</div>
					<el-checkbox-group
						v-if="
              tabledata.examAnswer.optiones != null ||
                tabledata.examAnswer.optiones != undefined
            "
						v-model="tabledata.examAnswer.optiones"
						@change="checked => checkboxChange(checked, tabledata.examAnswer,tabledata.options)"
					>
						<el-checkbox
							class="oneselect-body"
							style="display:block;"
							disabled
							v-for="(item, i2) in tabledata.options"
							:key="i2"
							:label="String.fromCharCode(i2 + 65)"
						>
							{{ String.fromCharCode(i2 + 65) }}.{{
							item.context
							}}
						</el-checkbox>
					</el-checkbox-group>
					<div style="display:flex;width:100%;">
						<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
							<span style="display: block;color:#E6A23C">学生答案：</span>
							<span style="display: block;color:#E6A23C">
								[
								<span v-for="(ans,an) in tabledata.examAnswer.optiones" :key="an">{{ans}}</span>]
							</span>
						</div>
						<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:20px">
							<span style="color:#67C23A">标准答案：</span>
							<span style="color:#67C23A">[{{tabledata.answer}}]</span>
						</div>
						<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
							<span style="color:#E6A23C">学生得分：</span>
							<span style="color:#E6A23C">{{tabledata.score}}</span>
						</div>
						<!-- <div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
             <span style="display: block;color:#67C23A" >教师评分： </span>
                          <div>
                    <el-input
               style="width:40%"
               type="number"
                ></el-input>
               </div>
						</div>-->
					</div>
				</div>

				<div class="bank-cotainer" v-if="tabledata.type == '填空题'">
					<div class="bank-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">填空</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.smallTopic
							}}
							<span>({{ tabledata.fraction}} 分)</span>
						</span>
					</div>
					<div class="bank-floote">
						<div class="bank-floote-answeritem">
							<div class="bank-floote-answeritem-body" style="width:100%">
								<span
									style="display:flex; flex-direction: column;width:100%"
									v-for="(item2, i2) in tabledata.options"
									:key="i2"
								>
									<!-- <div style="display:flex; width:100%;margin-bottom:10px;line-height:40px">
                    <el-input
                      style="width:80%"
                      readonly
                      v-model="item2.context"
                      @change="val => bankChange(val, tabledata.options,tabledata.examAnswer)"
                    ></el-input>
                    <div>({{ item2.fraction}}分)</div>
									</div>-->
									<div style="display:flex;width:100%;">
										<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
											<span style="color:#E6A23C">学生答案： {{item2.context}}</span>
											<!-- <span style="color:#E6A23C"></span> -->
										</div>
										<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:20px">
											<span style="color:#67C23A">标准答案： {{item2.answer}}</span>
											<!-- <span style="color:#67C23A"></span> -->
										</div>
									</div>
								</span>
								<div style="display:flex;">
									<div style=" width:30%;font-size:18px;margin-top:5px;">
										<span style="color:#E6A23C">学生得分： {{tabledata.examAnswer.score}}</span>
									</div>
									<!-- <div style="display:flex; width:30%;font-size:18px;margin-top:5px;margin-bottom:20px;margin-left:20px">
                      <span style="display:block;color:#67C23A">教师评分：</span>
                      <div>
                        <el-input
                          v-model="tabledata.examAnswer.teacherScore"
                          onkeyup="value=value.replace([0-9]\d*\.?\d*)|(0\.\d*[0-9],'')"
                           @change="val => teacherbankChange(val, tabledata.options,tabledata.examAnswer,tabledata.fraction)"
                          style="width:100%"
                          type="number"
                        ></el-input>
                      </div>

									</div>-->
								</div>
							</div>
						</div>
					</div>
				</div>

				<div class="oneselect-cotainer" v-if="tabledata.type == '判断题'">
					<div class="oneselect-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">判断</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.smallTopic
							}}
						</span>
						<span class="score">({{ tabledata.fraction }}分)</span>
					</div>
					<!-- <el-radio-group
            class="oneselect-body"
            disabled
            v-model="tabledata.examAnswer.optiones"
            @change="checked => roleChange(checked, tabledata.examAnswer)"
          >
            <el-radio label="true">正确</el-radio>
            <el-radio label="false">错误</el-radio>
					</el-radio-group>-->
					<div style="display:flex;">
						<div style="font-size:18px;width:30%">
							<span style="display: block;color:#E6A23C" v-if="tabledata.examAnswer.optiones=='true'">
								学生答案：
								正确
							</span>
							<span style="display: block;color:#E6A23C" v-if="tabledata.examAnswer.optiones=='false'">
								学生答案：
								错误
							</span>
						</div>
						<div style="font-size:18px;margin-top:5px;width:30%;margin-left:20px">
							<span style="display: block;color:#67C23A" v-if="tabledata.answer=='true'">标准答案：正确</span>
							<span style="display: block;color:#67C23A" v-if="tabledata.answer=='false'">标准答案：错误</span>
						</div>
						<div style="font-size:18px;margin-top:5px;width:20%;margin-left:20px">
							<span style="color:#67C23A">学生得分：{{tabledata.examAnswer.score}}</span>
						</div>
					</div>
				</div>

				<div class="brief-cotainer" v-if="tabledata.type == '简答题'">
					<div class="more-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">简答</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.smallTopic
							}}
						</span>
						<span class="score">({{ tabledata.fraction }}分)</span>
					</div>
					<!-- <div class="brief-item">
            <el-image
              v-for="(item, index) in tabledata.imgList"
              :key="index"
              class="brief-img-detail"
              :src="item"
              :preview-src-list="tabledata.imgList"
            >></el-image>
					</div>-->
					<div>
						<!-- <div class="brief-file-down" v-for="(item, index) in tabledata.fileList" :key="index">
              <span>文件{{ index + 1 }}</span>
              <el-link target="_blank" :href="item.url" :underline="false" style="margin-left:15px">
                <el-button size="mini" type="warning">点击下载</el-button>
              </el-link>
						</div>-->
						<!-- <el-input
              type="textarea"
              disabled
              :rows="5"
              v-model="tabledata.examAnswer.value"
              @change="val => putChange(val, tabledata.examAnswer)"
              style="margin-top:20px;"
						></el-input>-->
						<div style="display:flex;width:100%;">
							<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
								<span style="color:#E6A23C">学生答案： {{tabledata.examAnswer.value}}</span>
								<!-- <span style="color:#E6A23C">{{tabledata.examAnswer.value}}</span> -->
							</div>
							<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:40px;">
								<span style="color:#67C23A">标准答案： {{tabledata.answer}}</span>
								<!-- <span style="color:#67C23A">{{tabledata.answer}}</span> -->
							</div>
							<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:65px">
								<span style="color:#E6A23C">学生得分：</span>
								<span style="color:#E6A23C">{{tabledata.examAnswer.score}}</span>
							</div>
							<!-- <div style="display:flex; width:20%;font-size:18px;margin-top:5px;margin-left:20px">
                      <span style="width:130px;color:#67C23A">教师评分：</span>
                      <div>
                        <el-input
                          v-model="tabledata.examAnswer.teacherScore"
                          onkeyup="value=value.replace([0-9]\d*\.?\d*)|(0\.\d*[0-9],'')"
                          @change="val => teacherbankChange(val, tabledata.options,tabledata.examAnswer,tabledata.fraction)"
                          style="width:80%;margin-bottom:5px"
                          type="number"
                        ></el-input>
                      </div>
							</div>-->
						</div>
					</div>
				</div>

				<div class="bigquestion" v-if="tabledata.type == '大题'">
					<div class="more-header">
						<span style="font-size:18px">{{ i + 1 }}.</span>
						<span class="type">大题</span>
						<span class="oneselect-header-title" :id="'a'+tabledata.id">
							{{
							tabledata.bigQuestion
							}}
						</span>
						<span class="score">({{ tabledata.fraction }}分)</span>
					</div>
					<!-- <div class="brief-item">
            <el-image
              v-for="(item, index) in tabledata.imgList"
              :key="index"
              class="brief-img-detail"
              :src="item"
              :preview-src-list="tabledata.imgList"
            >></el-image>
          </div>
          <div class="brief-file">
            <div class="brief-file-down" v-for="(item, index) in tabledata.fileList" :key="index">
              <span>文件{{ index + 1 }}</span>
              <el-link target="_blank" :href="item.url" :underline="false" style="margin-left:15px">
                <el-button size="mini" type="warning">点击下载</el-button>
              </el-link>
            </div>
					</div>-->

					<div v-for="(item, i2) in tabledata.bankList" :key="i2">
						<div class="oneselect-cotainer" v-if="item.type == '单选题' || item.type == '单项选择题'">
							<div class="oneselect-header">
								<span style="font-size:18px">（{{ i2 + 1 }}）</span>
								<span class="type">单选</span>
								<span class="oneselect-header-title">
									{{
									item.smallTopic
									}}
								</span>
								<span class="score">({{ item.fraction }}分)</span>
							</div>
							<el-radio-group
								v-model="item.examAnswer.optiones"
								@change="checked => radioChnage(checked, item.examAnswer,item.options)"
							>
								<el-radio
									class="oneselect-body"
									style="display:block;"
									disabled
									v-for="(item2, i3) in item.options"
									:key="i3"
									:label="String.fromCharCode(i3 + 65)"
								>
									{{ String.fromCharCode(i3 + 65) }}.{{
									item2.context
									}}
								</el-radio>
							</el-radio-group>

							<div style="display:flex;width:100%;margin-bottom:10px">
								<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
									<span style="color:#E6A23C">学生答案：</span>
									<span style="color:#E6A23C">{{item.examAnswer.value}}</span>
								</div>
								<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:20px">
									<span style="color:#67C23A">标准答案：</span>
									<span style="color:#67C23A">{{item.answer}}</span>
								</div>
								<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px;">
									<span style="color:#E6A23C">学生得分：</span>
									<span style="color:#E6A23C">{{item.examAnswer.score}}</span>
								</div>
							</div>
						</div>
						<div class="more-cotainer" v-if="item.type == '多选题' || item.type == '多项选择题'">
							<div class="more-header">
								<span style="font-size:18px">（{{ i2 + 1 }}）</span>
								<span class="type">多选</span>
								<span class="oneselect-header-title">
									{{
									item.smallTopic
									}}
								</span>
								<span class="score">({{ item.fraction }}分)</span>
							</div>
							<el-checkbox-group
								v-model="item.examAnswer.optiones"
								@change="checked => checkboxChange(checked, item.examAnswer,item.options)"
							>
								<el-checkbox
									class="oneselect-body"
									style="display:block;"
									disabled
									v-for="(item2, i3) in item.options"
									:key="i3"
									:label="String.fromCharCode(i3 + 65)"
								>
									{{ String.fromCharCode(i3 + 65) }}.{{
									item2.context
									}}
								</el-checkbox>
							</el-checkbox-group>

							<div style="display:flex;width:100%;">
								<div style="display:flex;width:30%;font-size:18px;margin-top:5px;">
									<span style="color:#E6A23C">学生答案：</span>
									<span style="color:#E6A23C">
										[
										<span v-for="(ans,an) in item.examAnswer.optiones" :key="an">{{ans}}</span>]
									</span>
								</div>
								<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:40px">
									<span style="color:#67C23A">标准答案：</span>
									<span style="color:#67C23A">[{{item.answer}}]</span>
								</div>
								<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
									<span style="color:#E6A23C">学生得分：</span>
									<span style="color:#E6A23C">{{item.examAnswer.score}}</span>
								</div>
							</div>
						</div>

						<div class="oneselect-cotainer" v-if="item.type == '判断题'">
							<div class="oneselect-header">
								<span style="font-size:18px">（{{ i2 + 1 }}）</span>
								<span class="type">判断</span>
								<span class="oneselect-header-title">
									{{
									item.smallTopic
									}}
								</span>
								<span class="score">({{ item.fraction }}分)</span>
							</div>

							<!-- <el-radio-group
                class="oneselect-body"
                v-model="item.examAnswer.optiones"
                disabled
                @change="checked => roleChange(checked, item.examAnswer)"
              >
                <el-radio label="true">正确</el-radio>
                <el-radio label="false">错误</el-radio>
							</el-radio-group>-->

							<div style="display:flex;width:100%;">
								<div style="font-size:18px;width:30%">
									<span style="color:#E6A23C" v-if="item.examAnswer.optiones=='true'">
										学生答案：
										正确
									</span>
									<span style="color:#E6A23C" v-if="item.examAnswer.optiones=='false'">
										学生答案：
										错误
									</span>
								</div>
								<div style="font-size:18px;margin-top:5px;width:30%;margin-left:40px">
									<span style="color:#67C23A" v-if="item.answer=='true'">标准答案：正确</span>
									<span style="color:#67C23A" v-if="item.answer=='false'">标准答案：错误</span>
								</div>

								<div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
									<span style="color:#E6A23C">学生得分：</span>
									<span style="color:#E6A23C">{{item.examAnswer.score}}</span>
								</div>
							</div>
						</div>

						<div class="bank-cotainer" v-if="item.type == '填空题'">
							<div class="bank-header">
								<span style="font-size:18px">（{{ i2 + 1 }}）</span>
								<span class="type">填空</span>
								<span class="oneselect-header-title">
									{{
									item.smallTopic
									}}
								</span>
								<span>({{ item.fraction }}分)</span>
							</div>
							<div class="bank-floote">
								<div class="bank-floote-answeritem">
									<div class="bank-floote-answeritem-body" style="width:100%;">
										<span style="width:100%;" v-for="(item2, i4) in item.options" :key="i4">
											<!-- {{ item2.answer }} -->
											<!-- <el-input
                        disabled
                        v-model="item2.context"
                        @change="val => bankChange(val, item.options,item.examAnswer)"
											></el-input>-->

											<div style="display:flex;width:100%;">
												<div
													style="display:flex;width:30%;flex-direction: column;font-size:18px;margin-top:5px;"
												>
													<span style="color:#E6A23C">学生答案： {{item2.context}}</span>
													<!-- <span style="display: block;color:#E6A23C">{{item2.context}}</span> -->
												</div>
												<div style=" width:30%;font-size:18px;margin-top:5px;margin-left:40px">
													<span style="color:#67C23A">标准答案： {{item2.answer}}</span>
													<!-- <span style="display: block;color:#67C23A">{{item2.answer}}</span> -->
												</div>
												<!-- <div style=" width:20%;font-size:18px;margin-top:5px;margin-left:20px">
                      <span style="color:#E6A23C">学生得分： {{item.examAnswer.score}}</span>
                      <span style="display: block;color:#E6A23C">{{item.examAnswer.score}}</span>
												</div>-->
											</div>
										</span>

										<div style="display:flex;">
											<div style=" width:30%;font-size:18px;margin-top:5px;">
												<span style="color:#E6A23C">学生得分： {{item.examAnswer.score}}</span>
											</div>
											<!-- <div style="display:flex; width:30%;font-size:18px;margin-top:5px;margin-bottom:20px;margin-left:40px">
                      <span style="display:block;color:#67C23A">教师评分：</span>
                      <div>
                        <el-input
                          v-model="item.examAnswer.teacherScore"
                          onkeyup="value=value.replace([0-9]\d*\.?\d*)|(0\.\d*[0-9],'')"
                          @change="val => teacherbankChange(val, item.options,item.examAnswer,item.fraction)"
                          style="width:100%"
                          type="number"
                        ></el-input>
                      </div>
                       <span v-show="item.examAnswer.teacherScore!=null&&item.examAnswer.teacherScore>item.fraction" style="display:block;color:#C00000">评分必须小于题目分数</span>
											</div>-->
										</div>

										<!-- <div style=" display:flex;width:30%;font-size:18px;margin-top:5px;margin-bottom:20px">
                      <span style="display:block;color:#67C23A">教师评分：</span>
                      <div>

                        <el-input
                          v-model="item.examAnswer.teacherScore"
                          @change="val => teacherbankChange(val, item.options,item.examAnswer,item.fraction)"
                          style="width:100%"
                          type="number"
                        ></el-input>

                      </div>
                    </div>
										<span v-show="item.examAnswer.teacherScore>item.fraction" style="display:block;color:#C00000">评分必须小于题目分数</span>-->
									</div>
								</div>
							</div>
						</div>

						<div class="brief-cotainer" v-if="item.type == '简答题'">
							<div class="more-header">
								<span style="font-size:18px">（{{ i2 + 1 }}）</span>
								<span class="type">简答</span>
								<span class="oneselect-header-title">
									{{
									item.smallTopic
									}}
								</span>
								<span class="score">({{ item.fraction }}分)</span>
							</div>
							<!-- <div class="brief-item">
                <el-image
                  v-for="(item2, index2) in item.imgList"
                  :key="index2"
                  class="brief-img-detail"
                  :src="item2"
                  :preview-src-list="item.imgList"
                >></el-image>
							</div>-->
							<div style="width:100%">
								<div class="brief-file-down" v-for="(item2, index2) in item.fileList" :key="index2">
									<!-- <span>文件{{ index2 + 1 }}</span>
                  <el-link
                    target="_blank"
                    :href="item2.url"
                    :underline="false"
                    style="margin-left:15px"
                  >
                    <el-button size="mini" type="warning">点击下载</el-button>
									</el-link>-->
								</div>
								<!-- <el-input
                  type="textarea"
                  :rows="5"
                  v-model="item.examAnswer.value"
                  disabled
                  @change="val => putChange(val, item.examAnswer)"
                  style="margin-top:20px;"
								></el-input>-->
								<div style="display:flex;width:100%;">
									<div style="font-size:18px; width:30%;">
										<span style="color:#E6A23C">
											学生答案： {{item.examAnswer.value}}
											<!-- <span></span> -->
										</span>
									</div>
									<div style="font-size:18px;margin-top:5px;width:30%;margin-left:40px;">
										<span style="color:#67C23A">标准答案：{{item.answer}}</span>
									</div>
									<div style="width:20%;font-size:18px;margin-top:5px;margin-left:20px;">
										<span style="color:#E6A23C">学生得分：{{item.examAnswer.score}}</span>
										<!-- <span style="color:#E6A23C">{{item.examAnswer.score}}</span> -->
									</div>
									<!-- <div style="display:flex; width:15%;font-size:18px;margin-top:5px;margin-bottom:20px;">
                      <span style="width:150px;color:#67C23A;margin-right:5px">教师评分：</span>
                        <el-input
                          v-model="item.examAnswer.teacherScore"
                          onkeyup="value=value.replace([0-9]\d*\.?\d*)|(0\.\d*[0-9],'')"
                          @change="val => teacherbankChange(val, item.options,item.examAnswer,item.fraction)"
                          style="width:100%;"
                          type="number"
                        ></el-input>
									</div>-->
									<span
										v-show="item.examAnswer.teacherScore!=null&&item.examAnswer.teacherScore>item.fraction"
										style="display:block;color:#C00000"
									>评分必须小于题目分数</span>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="kong"></div>
			</div>
		</div>
	</div>
</template>

<script>
import { search } from '@/api/topic/showDetail'
import { listDetail } from '@/api/exam/review'
import { getPaper, getExamPaper, updateAnswer } from '@/api/paper/paper'
export default {
	name: 'showpaper',
	props: ['row'],
	data() {
		return {
			// 遮罩层
			paperdata: [],
			loading: true,
			exhead: 'http://10.168.100.154' + process.env.VUE_APP_BASE_API,
			container: [],
			showimgList: [],
			imgurl: '',
			showfileList: [],
			tescor: false,
			beanName: '',
			pointptions: [
				{
					label: '对',
					value: true,
				},
				{
					label: '错',
					value: false,
				},
			],
			options: [
				{
					answer: 'sdsada',
					fraction: 2,
				},
				{
					answer: 'sdsada',
					fraction: 2,
				},
				{
					answer: 'sdsada',
					fraction: 2,
				},
			],
		}
	},
	created() {
		this.getpaperdetail()
	},
	methods: {
		getpaperdetail() {
			this.paperdata = this.row
			setTimeout(() => {
				this.getdetailescore()
				this.gosearch()
			}, 1000)
			// const teminfo = {
			//   examineeId: this.row.id,
			//   sessionId: this.row.sessionId,
			//   paperId: this.row.paperId,
			// };
			// listDetail(teminfo).then((res) => {
			//   this.paperdata = res;
			//   console.log("试卷详细信息",this.paperdata)
			// });
			// setTimeout(() => {
			//   this.getdetailescore();
			//   this.gosearch();
			// }, 1000);
		},
		getdetailescore() {
			for (
				let t = 0;
				this.paperdata.paper.structureList !== null &&
				t < this.paperdata.paper.structureList.length;
				t++
			) {
				this.paperdata.paper.structureList[t].score = 0
				for (
					let k = 0;
					this.paperdata.paper.structureList[t].bankList !== null &&
					k < this.paperdata.paper.structureList[t].bankList.length;
					k++
				) {
					this.paperdata.paper.structureList[t].score +=
						this.paperdata.paper.structureList[t].bankList[k].fraction
				}
			}
		},
		gosearch() {
			for (let t = 0; t < this.paperdata.paper.structureList.length; t++) {
				this.paperdata.paper.structureList[t].container =
					this.paperdata.paper.structureList[t].bankList
				//填空题处理
				if (this.paperdata.paper.structureList[t].beanName == 'completionServiceImpl') {
					for (let k = 0; k < this.paperdata.paper.structureList[t].container.length; k++) {
						if (this.paperdata.paper.structureList[t].container[k].examAnswer.value != null) {
							let template =
								this.paperdata.paper.structureList[t].container[k].examAnswer.value.split('^^')
							for (
								let p = 0;
								p < this.paperdata.paper.structureList[t].container[k].options.length;
								p++
							) {
								this.paperdata.paper.structureList[t].container[k].options[p].context = template[p]
							}
						}
					}
				}

				if (this.paperdata.paper.structureList[t].container != null) {
					for (let j = 0; j < this.paperdata.paper.structureList[t].container.length; j++) {
						//   多选模型
						this.paperdata.paper.structureList[t].container[j].multipleFraction = []
						//处理简答题和大题的图片
						if (
							this.paperdata.paper.structureList[t].container[j].beanName ==
								'shortAnswerServiceImpl' ||
							this.paperdata.paper.structureList[t].container[j].beanName ==
								'bigQuestionServiceImpl'
						) {
							this.paperdata.paper.structureList[t].container[j].imgList = []
							this.paperdata.paper.structureList[t].container[j].fileList = []
							let imgtemplatedata = []
							let filetemplatedata = []
							if (this.paperdata.paper.structureList[t].container[j].fileUrl) {
								filetemplatedata =
									this.paperdata.paper.structureList[t].container[j].fileUrl.split(',')
								for (let k = 0; k <= filetemplatedata.length - 2; k++) {
									const data = {
										url: this.exhead + filetemplatedata[k],
										name: filetemplatedata[k],
									}
									this.paperdata.paper.structureList[t].container[j].fileList[k] = data
								}
							}

							if (this.paperdata.paper.structureList[t].container[j].imgUrl) {
								imgtemplatedata =
									this.paperdata.paper.structureList[t].container[j].imgUrl.split(',')
								for (let k = 0; k <= imgtemplatedata.length - 2; k++) {
									this.paperdata.paper.structureList[t].container[j].imgList[k] =
										this.exhead + imgtemplatedata[k]
								}
							}
						}

						//大题内简答题的图片和文件处理,大题内填空题处理
						if (this.paperdata.paper.structureList[t].container[j].bankList != null) {
							for (
								let h = 0;
								h < this.paperdata.paper.structureList[t].container[j].bankList.length;
								h++
							) {
								//填空题处理部分
								if (
									this.paperdata.paper.structureList[t].container[j].bankList[h].beanName ==
									'completionServiceImpl'
								) {
									if (
										this.paperdata.paper.structureList[t].container[j].bankList[h].examAnswer
											.value != null
									) {
										let templaarr =
											this.paperdata.paper.structureList[t].container[j].bankList[
												h
											].examAnswer.value.split('^^')
										// for(let q=0;q<this.paperdata.paper.structureList[t].container[j].bankList[h]){
										for (
											let w = 0;
											w <
											this.paperdata.paper.structureList[t].container[j].bankList[h].options.length;
											w++
										) {
											this.paperdata.paper.structureList[t].container[j].bankList[h].options[
												w
											].context = templaarr[w]
										}
									}

									// }
								}
								// 简答题处理部分
								if (
									this.paperdata.paper.structureList[t].container[j].bankList[h].beanName ==
									'shortAnswerServiceImpl'
								) {
									this.paperdata.paper.structureList[t].container[j].bankList[h].imgList = []
									this.paperdata.paper.structureList[t].container[j].bankList[h].fileList = []
									let imgtemplatedata = []
									let filetemplatedata = []

									if (this.paperdata.paper.structureList[t].container[j].bankList[h].fileUrl) {
										filetemplatedata =
											this.paperdata.paper.structureList[t].container[j].bankList[h].fileUrl.split(
												','
											)
										for (let k = 0; k <= filetemplatedata.length - 2; k++) {
											const data = {
												url: this.exhead + filetemplatedata[k],
												name: filetemplatedata[k],
											}
											this.paperdata.paper.structureList[t].container[j].bankList[h].fileList[k] =
												data
										}
									}
									if (this.paperdata.paper.structureList[t].container[j].bankList[h].imgUrl) {
										imgtemplatedata =
											this.paperdata.paper.structureList[t].container[j].bankList[h].imgUrl.split(
												','
											)
										for (let k = 0; k <= imgtemplatedata.length - 2; k++) {
											this.paperdata.paper.structureList[t].container[j].bankList[h].imgList[k] =
												this.exhead + imgtemplatedata[k]
										}
									}
								}
							}
						}
						// 处理多项
						if (
							this.paperdata.paper.structureList[t].container[j].type == '多项选择题' &&
							this.paperdata.paper.structureList[t].container[j].examAnswer.optiones != null
						) {
							this.paperdata.paper.structureList[t].container[j].examAnswer.optiones =
								this.paperdata.paper.structureList[t].container[j].examAnswer.optiones.split('^^')
						} else if (
							this.paperdata.paper.structureList[t].container[j].type == '多项选择题' &&
							this.paperdata.paper.structureList[t].container[j].examAnswer.optiones == null
						) {
							//   没有选择置空数组
							this.paperdata.paper.structureList[t].container[j].examAnswer.optiones = []
						}

						// 处理大题多选
						if (
							this.paperdata.paper.structureList[t].container[j].beanName ==
							'bigQuestionServiceImpl'
						) {
							this.bigMuch(this.paperdata.paper.structureList[t].container[j])
						}
					}
				}
			}
			//  this.container = this.row.bankList

			this.loading = false
		},

		// 处理大题多选
		bigMuch(arr) {
			for (let i = 0; i < arr.bankList.length; i++) {
				if (arr.bankList[i].beanName == 'multipleChoiceServiceImpl') {
					if (arr.bankList[i].examAnswer.optiones != null) {
						arr.bankList[i].examAnswer.optiones = arr.bankList[i].examAnswer.optiones.split('^^')
					} else if (arr.bankList[i].examAnswer.optiones == null) {
						arr.bankList[i].examAnswer.optiones = []
					}
				}
			}
		},
		download(data) {
			//  let url=data.filename;
			// this.download(data);
			//  this.download(this.showfileList[data].url)
		},
		// 处理单选
		radioChnage(val, obj, table) {
			for (let i = 0; i < table.length; i++) {
				table[i].opt = String.fromCharCode(i + 65)
				if (table[i].opt == val) {
					obj.value = table[i].context
				}
			}
			updateAnswer(obj).then((res) => {
				console.log(res)
			})
		},
		// 处理多选
		checkboxChange(val, item, table) {
			let tmp = []
			for (let i = 0; i < table.length; i++) {
				table[i].opt = String.fromCharCode(i + 65)
				for (let k = 0; k < val.length; k++) {
					if (table[i].opt == val[k]) {
						tmp.push(table[i].context)
					}
				}
			}
			item.value = tmp.join('^^')
			let obj = JSON.stringify(val)
			let map = JSON.stringify(item)
			let objct = JSON.parse(map)
			objct.optiones = JSON.parse(obj).join('^^')
			updateAnswer(objct).then((res) => {
				console.log(res)
			})
		},
		// 判断题
		roleChange(val, item) {
			updateAnswer(item).then((res) => {
				console.log(res)
			})
		},
		// 简答题
		putChange(val, item) {
			console.log(item)
			updateAnswer(item).then((res) => {
				console.log(res)
			})
		},
		//老师填空题打分
		teacherbankChange(val, item, table, fraction) {
			const that = this
			if (val > fraction) {
				return
			} else {
				table.score = val
				updateAnswer(table).then((res) => {})
			}
		},
		//填空题
		bankChange(val, item, table) {
			table.value = ''
			for (let i = 0; i < item.length; i++) {
				if (i == 0) {
					if (item[i].context == '' || item[i].context == null) {
						table.value = ''
					} else {
						table.value = item[i].context
					}
				} else {
					if (item[i].context == '' || item[i].context == null) {
						table.value = table.value + '^^'
					} else {
						table.value = table.value + '^^' + item[i].context
					}
				}
			}
			updateAnswer(table).then((res) => {
				console.log(res)
			})
		},
	},
}
</script>

<style>
.kong {
	width: 100%;
	height: 5px;
}
.totalhead {
	display: flex;

	justify-content: center;
	width: 50%;
	margin-left: 50%;
	transform: translateX(-50%);
	font-size: 20px;
	margin-top: 20px;
	margin-bottom: 20px;
}
.rule {
	font-size: 18px;
	font-weight: 500;
	color: #909399;
}
.all {
	width: 100%;
	height: 100%;
	/* background-color: #E4E7ED; */
}
.box {
	padding-top: 20px;
	margin-left: 10px;
	margin-right: 10px;
}
.allhead {
	text-align: center;
	color: #303133;
	font-size: 40px;

	font-weight: 600;
}
.oneselect-header-title {
	font-size: 18px;
	color: #303133;
}
.type {
	font-size: 16px;
	color: #67c23a;
	border: 1px solid #67c23a;
	margin-right: 10px;
}
.body-chose1 {
	color: #67c23a;
}
.body-chose2 {
	color: #f56c6c;
}
.score {
	color: #909399;
	margin-left: 5px;
}
.answer {
	font-size: 18px;
	color: #67c23a;
}
.oneselect-cotainer {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-top: 15px;
	margin-bottom: 20px;
	border: 2px solid #dcdfe6;
}
.oneselect-header {
	font-size: 16px;
	color: #303133;
	margin-top: 5px;
}
.oneselect-body {
	margin-top: 10px;
	margin-left: 10px;
	padding-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	border-bottom: 1px dashed #dcdfe6;
	color: #303133;
}
.oneselect-floote {
	margin-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #67c23a;
	border-bottom: 1px dashed #dcdfe6;
}
.oneselect-floote-answer {
	margin-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #303133;
	border-bottom: 1px dashed #dcdfe6;
}
.more-cotainer {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-top: 40px;
	margin-bottom: 40px;
	border: 2px solid #dcdfe6;
}
.more-header {
	font-size: 16px;
	color: #303133;
	margin-top: 5px;
}
.more-body {
	margin-top: 10px;
	margin-left: 10px;
	font-size: 18px;
	color: #303133;
	padding-top: 10px;
	padding-bottom: 10px;
	border-bottom: 1px dashed #dcdfe6;
}
.more-floote {
	margin-top: 10px;
	font-size: 18px;
	padding-bottom: 10px;
	color: #67c23a;
	border-bottom: 1px dashed #dcdfe6;
}
.more-floote-answer {
	margin-top: 10px;
	font-size: 18px;
	padding-bottom: 10px;
	border-bottom: 1px dashed #dcdfe6;
	color: #303133;
}
.bank-cotainer {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-top: 40px;
	margin-bottom: 40px;
	border: 2px solid #dcdfe6;
}
.bank-header {
	font-size: 16px;
	color: #303133;
}
.bank-body {
	margin-top: 10px;
	margin-left: 10px;
	font-size: 18px;
	color: #303133;
	border-bottom: 1px dashed #dcdfe6;
}
.bank-floote {
	margin-top: 20px;
	color: #303133;
	border-bottom: 1px dashed #dcdfe6;
}
.bank-floote-answer {
	margin-left: 10px;
	color: #303133;
}
.bank-floote-answeritem {
	display: flex;
	font-size: 18px;
	color: #303133;
	padding-bottom: 10px;
	border-bottom: 1px dashed #dcdfe6;
}
.bank-floote-answeritem-body {
	display: flex;
	flex-direction: column;
	margin-left: 5px;
}
.bank-floote-explains {
	display: block;
	padding-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #67c23a;
}
.judge-chose {
	margin-top: 15px;
	padding-bottom: 10px;
	display: flex;
	border-bottom: 1px dashed #dcdfe6;
	color: #303133;
}
.judge-chose-item {
	margin-left: 20px;
	font-size: 18px;
	color: #303133;
}
.bigquestion {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-top: 40px;
	margin-bottom: 40px;
}
.brief-cotainer {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-top: 40px;
	margin-bottom: 40px;
	border: 2px solid #dcdfe6;
}
.judge-floote {
	margin-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #67c23a;
	border-bottom: 1px dashed #dcdfe6;
}
.judge-floote-answeritem {
	margin-top: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #303133;
	border-bottom: 1px dashed #dcdfe6;
}
.brief-header {
	font-size: 16px;
	color: #303133;
}
.brief-body {
	margin-top: 20px;
	margin-left: 10px;
	padding-bottom: 10px;
	font-size: 18px;
	color: #303133;
	border-bottom: 1px dashed #dcdfe6;
}
.brief-floote {
	margin-top: 20px;
	padding-bottom: 20px;
	margin-left: 10px;
	font-size: 18px;
	color: #67c23a;
	border-bottom: 1px dashed #dcdfe6;
}
.brief-item {
	display: flex;
	justify-content: space-around;
	flex-wrap: wrap;
}
.brief-img-detail {
	width: 200px;
	height: 200px;
	margin-top: 20px;
	margin-bottom: 20px;
	border: 1px solid #e4e7ed;
}
.brief-file {
	display: flex;
	flex-direction: column;
	margin-left: 20px;
	justify-content: center;
	color: #909399;
}
.brief-file-down {
	font-size: 18px;
	margin-top: 20px;
}
.paperitemhead {
	color: #303133;
	font-size: 20px;
	font-weight: 500;
}
.table {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	color: #606266;
}
.table-top {
	width: 80px;
	height: 50px;
	text-align: center;
	line-height: 50px;
	font-weight: 550;
	border-top: 1px solid #dcdfe6;
	border-left: 1px solid #dcdfe6;
	border-bottom: 1px solid #dcdfe6;
}
.table-top-end {
	width: 80px;
	height: 50px;
	text-align: center;
	line-height: 50px;
	font-weight: 550;
	border: 1px solid #dcdfe6;
}
.table-bottom {
	width: 80px;
	height: 50px;
	text-align: center;
	line-height: 50px;
	border-left: 1px solid #dcdfe6;
	border-bottom: 1px solid #dcdfe6;
}
.table-bottom-end {
	width: 80px;
	height: 50px;
	text-align: center;
	line-height: 50px;
	border-left: 1px solid #dcdfe6;
	border-bottom: 1px solid #dcdfe6;
	border-right: 1px solid #dcdfe6;
}
</style>
